Skip to content

feat: give the nested object and its parents to class-level object mapper transforms - #373

Merged
joelwurtz merged 5 commits into
mainfrom
fix/object-mapper-class-transform-value
Dec 3, 2026
Merged

joelwurtz merged 5 commits into
mainfrom
fix/object-mapper-class-transform-value

Conversation

@joelwurtz

@joelwurtz joelwurtz commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

A class-level transform declared with #[Map(transform: ...)] on a nested source class does not receive the same arguments as with the Symfony ObjectMapper. With the new objectMapperNestedTransformReceivesSource configuration option (object_mapper_nested_transform_receives_source in the bundle), it receives the nested object, the parent source and the parent target, as Symfony does. Root objects and MapCollection items are unchanged.

The option defaults to false (current behavior). Not setting it is deprecated, it will default to true in 11.0.

Depends on #376.

@joelwurtz
joelwurtz force-pushed the fix/object-mapper-class-transform-value branch from fd68a9c to d76ab72 Compare December 3, 2026 14:04
@joelwurtz joelwurtz changed the title fix: give the nested object to its class-level object mapper transform feat: give the nested object and its parents to class-level object mapper transforms Dec 3, 2026
@joelwurtz
joelwurtz changed the base branch from build/symfony-8.2 to feat/object-mapper-mapping-aware-transform December 3, 2026 14:04
@joelwurtz
joelwurtz force-pushed the fix/object-mapper-class-transform-value branch from d76ab72 to e2e4d64 Compare December 3, 2026 15:43
@joelwurtz
joelwurtz force-pushed the feat/object-mapper-mapping-aware-transform branch from 38eacbc to 0cfd0df Compare December 3, 2026 15:43
@joelwurtz
joelwurtz changed the base branch from feat/object-mapper-mapping-aware-transform to main December 3, 2026 15:44
@joelwurtz
joelwurtz merged commit c6ac4a8 into main Dec 3, 2026
12 checks passed
@joelwurtz
joelwurtz deleted the fix/object-mapper-class-transform-value branch December 3, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant